<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card layui-form">

                <div class="layui-card-body">

                    <%-- 数据展示 --%>
                    <table class="layui-table" lay-filter="table" id="table">
                    </table>

                    <script type="text/html" id="id">
                        <a href="/cash/showAddBank?bankId={{d.id}}"  class='layui-btn' >编辑</a>
                        <a onclick="deleteById('{{d.id}}')" href="#" class='layui-btn' >删除</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/sx/login/jquery3.4.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','laydate', 'table'], function(){
        var $ = layui.$,form = layui.form,laydate=layui.laydate, table = layui.table;
        form.render('select');
        laydate.render({
            elem: '#laydate-cn',
            range:'~'
        });

        table.render({
            elem : '#table',
            height:1000,
            url:'/cash/queryBankList',
            page:true,
            request: {
                pageName: 'current', //页码的参数名称，默认：page
                limitName: 'size' //每页数据量的参数名，默认：limit
            }
            ,cols: [[
                {field:'id', width:80, title: '编号'}
                ,{field:'bankName', width:130, title: '银行名称'}
                ,{field:'realName', width:160, title: '真实姓名'}
                ,{field:'idcard', width:230, title: '证件号'}
                ,{field:'bankCard', width:230, title: '银行卡卡号'}
                ,{field:'bankAddr', width:230, title: '开户行地址'}
                ,{field:'phone', width:180, title: '预留手机号'}
                ,{field:'createTime'
                    , width:200
                    , title:'创建时间'
                    ,templet: "<div>{{layui.util.toDateString(d.createTime,'yyyy-MM-dd HH:mm:ss')}}</div>"
                }
                ,{field:'id', width:210, title: '操作',templet:"#id"}
            ]],
            skin : "row",
            even: true,
            size:"lg",
            done: function(){
                height: 1000; //设置高度
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
// 			    console.log(res);
                //得到当前页码
// 			    console.log(curr);
                //得到数据总量
// 			    console.log(count);
            }

        });
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field
            //执行重载
            table.reload('table', {
                where: field
            });
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //日期范围
            laydate.render({
                elem: '#laydate-cn'
                ,range: true
            });
            window.deleteById = function (bankid){
                $.ajax({
                    type: "post",
                    url: "/cash/deleteBankById?bankId="+bankid,
                    async: false,//同步提交。不设置则默认异步，异步的话，最后执行ajax
                    dataType: "json",
                    success: function (data) {
                        window.location.reload();

                    }
                })
            };
        });
    });
</script>
</body>
</html>
